feat(modules): add ability to restart modules#1755
feat(modules): add ability to restart modules#1755paul-nechifor wants to merge 2 commits intodevfrom
Conversation
Greptile SummaryThis PR adds
Confidence Score: 4/5Not safe to merge as-is due to two P1 defects: a KeyError on modules deployed via deploy() and a silent transport-wiring failure when stream remappings are used. Two P1 bugs are present in restart_module — an unguarded dict access that crashes for modules deployed outside the blueprint path, and a key mismatch in _transport_registry that silently disconnects remapped streams. Both are straightforward to fix but affect correctness of the primary feature. All other findings are P2 style issues. dimos/core/coordination/module_coordinator.py lines 365 and 397-402 Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant MC as ModuleCoordinator
participant WMP as WorkerManagerPython
participant OW as OldPythonWorker
participant NW as NewPythonWorker
User->>MC: restart_module(MyModule)
MC->>MC: read _deployed_atoms[module_class]
MC->>MC: capture inbound_refs, outbound_refs
MC->>MC: unload_module(module_class)
MC->>OW: proxy.stop()
MC->>WMP: undeploy(proxy)
WMP->>OW: undeploy_module(module_id)
OW-->>WMP: ok
WMP->>OW: shutdown() if empty
OW-->>WMP: ok
WMP->>WMP: remove worker from pool
opt reload_source=True
MC->>MC: importlib.reload(source_mod)
MC->>MC: new_class = getattr(source_mod, name)
end
MC->>WMP: deploy_fresh(new_class, config, kwargs)
WMP->>NW: start_process()
WMP->>NW: deploy_module(new_class, ...)
NW-->>WMP: actor
WMP-->>MC: new_proxy (RPCClient)
MC->>MC: reconnect streams via _transport_registry
MC->>MC: rewire inbound module refs
MC->>MC: rewire outbound module refs
MC->>NW: new_proxy.build()
MC->>NW: new_proxy.start()
MC-->>User: new_proxy
Reviews (1): Last reviewed commit: "feat(modules): add ability to restart mo..." | Re-trigger Greptile |
a813ca8 to
e1cf940
Compare
e1cf940 to
869648f
Compare
Problem
We cannot restart modules.
Closes DIM-782
Solution
Breaking Changes
None
How to Test
Contributor License Agreement